package com.tml.thboot;

import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@SpringBootApplication
@Controller
public class App {


	public static void main(String[] args) throws Exception {
		SpringApplication.run(App.class, args);
	}
	@RequestMapping("/user")
	public	String	listUsers(Model	model) {
		model.addAttribute("users", queryUsers());
		return	"user";
	}
	private	List<User>	queryUsers(){
		List<User>	users	=	new	ArrayList<User>();
		users.add(new	User(1,"userA"));
		users.add(new	User(2,"userB"));
		return users;
	}
	class	User{
		private	int	age;
		private	String	name;
		
		
		public int getAge() {
			return age;
		}


		public void setAge(int age) {
			this.age = age;
		}


		public String getName() {
			return name;
		}


		public void setName(String name) {
			this.name = name;
		}


		public User(int age, String name) {
			super();
			this.age = age;
			this.name = name;
		}
		
	}
}
